using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace IUPUI.StellarResults.Client
{
	/// <summary>
	/// Form to caputure a new position to move an <see cref="Observatory"/> to.
	/// </summary>
	public partial class ChangePositionForm : Form
	{
		#region Public Properties
		/// <summary>
		/// Gets or sets the azimuth.
		/// </summary>
		/// <value>The azimuth.</value>
		public double Azimuth
		{
			get
			{
				return (double)m_AzimuthTextBox.Value;
			}
			set
			{
				try
				{
					m_AzimuthTextBox.Value = (decimal)value;
				}
				catch (ArgumentOutOfRangeException ex)
				{
					ININ.Logging.Trace.TraceError(ex.ToString());
					m_AzimuthTextBox.Value = 0;
				}
			}
		}

		/// <summary>
		/// Gets or sets the altitude.
		/// </summary>
		/// <value>The altitude.</value>
		public double Altitude
		{
			get
			{
				return (double)m_AltitudeTextBox.Value;
			}
			set
			{
				try
				{
					m_AltitudeTextBox.Value = (decimal)value;
				}
				catch (ArgumentOutOfRangeException ex)
				{
					ININ.Logging.Trace.TraceError(ex.ToString());
					m_AltitudeTextBox.Value = 0;
				}
			}
		}
		#endregion Public Properties

		#region Constructors
		/// <summary>
		/// Initializes a new instance of the <see cref="ChangePositionForm"/> class.
		/// </summary>
		public ChangePositionForm()
		{
			InitializeComponent();
		}
		#endregion Constructors

		/// <summary>
		/// Handles the KeyDown event of the ChangePositionForm control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="System.Windows.Forms.KeyEventArgs"/> instance containing the event data.</param>
		private void ChangePositionForm_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Enter)
			{
				this.DialogResult = DialogResult.OK;
			}
		}
	}
}